Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

get-uri

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-uri

Returns a `stream.Readable` from a URI string

  • 2.0.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9.2M
decreased by-0.42%
Maintainers
1
Weekly downloads
 
Created

What is get-uri?

The get-uri npm package is designed to retrieve the contents of a URI string using different protocols. It supports protocols like HTTP, HTTPS, Data, File, and more. The package provides a simple API to fetch URIs in a protocol-agnostic way, which can be particularly useful when working with a variety of resource identifiers.

What are get-uri's main functionalities?

HTTP/HTTPS URI retrieval

This feature allows you to retrieve resources over HTTP or HTTPS. The code sample demonstrates how to fetch a resource from 'http://example.com' and pipe the response stream to the standard output.

const getUri = require('get-uri');

getUri('http://example.com', function (err, rs) {
  if (err) throw err;
  rs.pipe(process.stdout);
});

Data URI retrieval

This feature enables you to decode Data URIs and access the data as a stream. The code sample shows how to decode a base64-encoded 'Hello, World!' message from a Data URI and pipe it to the standard output.

const getUri = require('get-uri');

getUri('data:text/plain;base64,SGVsbG8sIFdvcmxkIQ==', function (err, rs) {
  if (err) throw err;
  rs.pipe(process.stdout);
});

File URI retrieval

This feature allows you to read local files using the file URI scheme. The code sample demonstrates how to create a file URI from a local file path and then use get-uri to read the file and pipe its contents to the standard output.

const getUri = require('get-uri');
const path = require('path');

const filePath = path.resolve('path/to/your/local/file.txt');
const fileUri = 'file://' + filePath;

getUri(fileUri, function (err, rs) {
  if (err) throw err;
  rs.pipe(process.stdout);
});

Other packages similar to get-uri

Keywords

FAQs

Package last updated on 10 Oct 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc